﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Sunnytech
{
    public partial class _404 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string url = HttpContext.Current.Request.Url.Query.ToString();

          // HttpContext.Current.Server.Transfer("ViewGroupProduct.aspx?catID=1");
            string[] urlInfo404 = Request.Url.Query.ToString().Split(';');

            if (urlInfo404.Length > 1 )
            {
                string requestURL = urlInfo404[1].Replace("http://", "");

                if(requestURL.Contains("www"))
                    requestURL = requestURL.Replace("www.a-mark.vn:8080/","");
                else
                    requestURL = requestURL.Replace("a-mark.vn:8080/", "");

               
                requestURL = LIB.RewriteURL.getRealUrl(requestURL, Server.MapPath("RewriteUrl.xml"));
                
                if(requestURL=="Error.htm")

                    HttpContext.Current.Server.Transfer("/Error.aspx");

                else

                HttpContext.Current.Server.Transfer("/"+requestURL);

            }

            HttpContext.Current.Server.Transfer("/trangchu.htm");

        }
    }
}